package com.kgc.service.impl;

import com.kgc.entity.EmpExample;
import com.kgc.entity.User;
import com.kgc.entity.UserExample;
import com.kgc.mapper.UserMapper;
import com.kgc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: luo
 * @date: 2024/4/9 9:32
 * @Description:
 * @Version: 1.0
 *
 * 用户登录实现
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public boolean login(User user) {
        UserExample example = new UserExample();
        example.createCriteria()
                .andNameEqualTo(user.getName())
                .andPwdEqualTo(user.getPwd());
        List<User> users = userMapper.selectByExample(example);
        if (users.size() > 0){
            return true;
        }
        return false;
    }
}
